package WaiBao;

import java.util.Arrays;

public class HanYuTing {
    public static void main(String[] args) {
        String[] name = {"包春燕(班长)", "黄平(团支书)", "小李(学习委员)", "郭芙蓉(体育委员)", "郭英梅", "张雪荣", "吴启菊", "陈运兵", "刘芳", "黄几名", "唐永强", "国金",
                "王宇", "左立", "何红梅", "何兴勇", "何玉梅", "陈轻轨", "胡丽萍", "珠江", "李大伟", "左倾", "师进", "李小军", "罗开放", "宋代琼", "赵翔宇", "权利方",
                "谢艳梅", "韩雨婷(学生)"};//考生本人: 韩雨婷(学生)
        int[] Age = {19, 20, 18, 19, 18, 21, 18, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁

        double[] pingguo1 = {88, 82, 84, 90, 68, 69, 78, 89, 80, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] pingguo2 = {78, 85, 69, 66, 68, 67, 88, 79, 90, 90, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 95};
        double[] pingguo3 = {78, 96, 80, 95, 79, 69, 78, 89, 80, 60, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double xiangjiao;//代表每个学生的总分
        double juzi;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            xiangjiao = pingguo1[i] + pingguo2[i] +pingguo3[i];
//            juzi = (xiangjiao * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + xiangjiao);
//            System.out.println(name[i] + "的平均分为:" +juzi);
//        }


        double Result = 0, Average = 0;
        double[] li = new double[30];
//        for (int i = 0; i < 30; i++) {
//            Result = pingguo1[i] + pingguo2[i] + pingguo3[i];
//            juzi = (Result * 1.0) / 3;
//            li[i] = juzi;
//        }
//
//        for (int i = 0; i < li.length - 1; i++) {
//            for (int j = 0; j < li.length - i - 1; j++) {
//                if (li[j] < li[j + 1]) {
//                    double tep = li[j];
//                    li[j] = li[j + 1];
//                    li[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(li[i]);
//        }


        double yangtao1 = 0,yangtao2 = 0, yangtao3 = 0;//计算每门课的平均分
        double mihou1 = 0,mihou2 = 0, mihou3 = 0;//计算每门课标准差
        double m1 = 0, m2 = 0, m3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < pingguo1.length; i++) {
            sum2+=pingguo1[i];
        }
        yangtao1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+yangtao1);
        double Sum = 0;
        for (int i = 0; i < pingguo2.length; i++) {
            Sum+=pingguo2[i];
        }
        yangtao2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+yangtao2);
        double sum = 0;
        for (int i = 0; i <pingguo3.length; i++) {
            sum+=pingguo3[i];
        }
        yangtao3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+yangtao3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i < pingguo1.length; i++) {
            c1+= (pingguo1[i] - yangtao1)*(pingguo1[i] - yangtao1);
        }
        mihou1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+mihou1);

        for (int i = 0; i < pingguo2.length; i++) {
            c2+= (pingguo2[i] - yangtao2)*(pingguo2[i] - yangtao2);
        }
        mihou2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+mihou2);

        for (int i = 0; i < pingguo3.length; i++) {
            c3+= (pingguo3[i] -yangtao3)*(pingguo3[i] - yangtao3);
        }
        mihou3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+mihou3);
//
        Arrays.sort(pingguo1);
        Arrays.sort(pingguo2);
        Arrays.sort(pingguo3);
        m1 =( pingguo1[14]+pingguo1[15])*1.0/2;
        m2 =( pingguo2[14]+pingguo2[15])*1.0/2;
        m3 =( pingguo3[14]+pingguo3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+m1);
        System.out.println("微生物学的中位数为:"+m2);
        System.out.println("人体组织解剖学的中位数为:"+m3);
    }
}
